package com.luwanglin.oss.controller;

import com.luwanglin.commonutils.R;
import com.luwanglin.oss.service.impl.FileServiceImpl;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author lwl
 */
@RestController
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private FileServiceImpl fileService;

    @PostMapping
    public R uploadOssFile(MultipartFile file) {
        String url = fileService.uploadAvatar(file);
        return R.ok().data("url", url);
    }
}
